#ifndef MYGRADETABLEWIDGET_H
#define MYGRADETABLEWIDGET_H

#include <QWidget>
#include <QVector>
#include<QList>
#include <QMessageBox>

#include "model.h"
#include"sqlitetools.h"
#include"config/constvariable.h"
#include "initconfig.h"

QT_BEGIN_NAMESPACE
class QLineEdit;
class QTableWidget;
class QTableWidgetItem;
class QPushButton;
class QDateEdit;
QT_END_NAMESPACE

class MyGradeTableWidget : public QWidget
{
  Q_OBJECT

public:
  explicit MyGradeTableWidget(QWidget *parent = nullptr);
  ~MyGradeTableWidget();


  void create();




public slots:
 void updateGrade(QVector<Target_Info_Table>&data);

signals:
    void signalSearchdate(int group,int addr,QString& time);
    //日期改变
    void signalDateChange(QString time);
    //靶号和组号改变
    void signal_addr_groupnumber_change(int addr,int groupnumber);

private slots:
  void check_clicked();

//  void runHandleExcel();

//  void changeAddrandGroupnumber(int addr,int groupnumber);
//  void changeDate(QString time);

  void dateChange(const QDate &date);

  void out_clicked();

private:

  InitConfig initconfig;

  QList<QList<int>>   huanShuList;                // 定义弹孔列表对象
  QList<QList<int>>   baHaoList;                // 定义靶号列表对象
  QList<QList<int>>   baHaoAndFenZu;

  QString currentDate;


//  QXlsx::Document xlsx;

  int baHao = -1;
  int fenZu = -1;

  QTableWidgetItem *baWei = nullptr;

  QTableWidgetItem *fenZuIndex =nullptr;

  QTableWidgetItem *name = nullptr;

  QTableWidgetItem *onlyHuanShu = nullptr;

  QTableWidgetItem *allSum = nullptr;

  QTableWidget *tableWidget = nullptr;

  QLineEdit *lineEditGroup = nullptr;
  QLineEdit *lineEditNum = nullptr;

  QPushButton *btnCheck = nullptr;

  QPushButton *btnOut = nullptr;

  QDateEdit *dateEdit = nullptr;

    SQLiteTools *sqliteTools = nullptr;

//    QVector<Target_Info_Table> searchData;

    QVector<Target_Info_Table> searchName;
};


#endif // MYGRADETABLEWIDGET_H
